package com.cslg.ac.demo.dao.donate;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface DonateDAO {
    String TABLE_NAME = "e_t_donation";
    String SELECT_FIELD = "id, user_id userId, team_id teamId, donate_time donateTime, card_type cardType, card_count cardCount ";
    String INSERT_FIELD = "(user_id, team_id, card_type, card_count)";


    @Insert({"insert into ", TABLE_NAME, INSERT_FIELD, " values(#{userId}, #{teamId}, #{cardType}, #{cardCount})"})
    void insert(DonationPO donationPO);

    @Select({"select ", SELECT_FIELD, "from ", TABLE_NAME, "where id = #{id}"})
    DonationPO selectById(@Param("id")int id);

}
